package com.homework;

import java.text.NumberFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;

public class Homework {
    public static void main(String[] args) {
        Date();
        ToHum();
        Snake();
        separator();
    }
//格式化日期
    public static void Date(){
        LocalDate date = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年 MM月 dd日");
        String text = date.format(formatter);
        System.out.println(text);
    }


//    蛇行转驼峰
    public static void ToHum() {
        String camel = "my_name";
        System.out.println(camel);
        String[] a=camel.split("_");
//        System.out.println(Arrays.toString(a));
        String string1 =a[0];
        String string2 =a[1];
//        System.out.println(string);
        char[] temp = string1.toCharArray();
        temp[0]-=32;
        char[] temp1 =string2.toCharArray();
        temp1[0]-=32;
        String q=String.valueOf(temp);
        String e=String.valueOf(temp1);
        System.out.println(q+e);


    }
    //驼峰转蛇形
    public static void Snake( ) {
        String camel = "numBoner";
        System.out.println(camel);
//        char[] a=Arrays.toString(camel)
        String ss = "";
        for (int i = 0; i < camel.length(); i++) {
            char c = camel.charAt(i);
            if (c > 65 && c < 90 && i != 0) {
                ss += "_" + c;
            } else {
                ss += c;
            }
        }
        String newS = ss.toLowerCase();
        System.out.println(newS);
    }

    //千位分隔符
    public static void separator(){
            double b=1234567.03;
            NumberFormat a = NumberFormat.getNumberInstance();
            System.out.println(a.format(b));

    }
}



